local ToT = TrickOrTreat

--[[ Options ]]--
ToT.defaults = {
	profile = {
		warningmsg = "Trick or Treat!",
		targetwarn = true,
		targetreport = true,
		ignoretanks = false,
		selfreport = true,
		selfwarn = true,
		usemasterchannel = false,
		threatwarn = true,
		threatpercent = 60,
		threatraw = 50000,
		cdwarn = false,
		cdprint = false,
		cdpour = false,
		cdsound = false,
		cdsoundfile = "Ding",
		cdsoundonmaster = true,
		cdwarntime = 0,
	},
}

ToT.options = {
	type = "group",
	args = {
		tells = {
			type = "group",
			name = "Notifications",
			desc = "Notifications",
			args = {
				player = { 
					type = "group",
					inline = true,
					name = "Player",
					desc = "Player",
					order = 1,
					get = function(info) return ToT.db.profile[ info[#info] ] end,
					set = function(info, v) ToT.db.profile[ info[#info] ] = v end,
					args = {
						selfreport = {
							type = "toggle",
							name = "Report to self",
							desc = "Print damage dealt by self and extra damage caused by target when Tricks expires.",
							order = 1,
						},
						selfwarn = {
							type = "toggle",
							name = "Warn self",
							desc = "Audio/Visual warning when you receive Tricks.",
							order = 2,
						},
						usemasterchannel = {
							type = "toggle",
							name = "Sound on Master",
							desc = "Use the Master Sound channel instead of the Sound Effects channel for playing the audio warning received when Tricks is cast on you. (If set, this ignores the SFX channel volume slider.)",
							order = 3,
						},
					},
				},
				target = {
					type = "group",
					inline = true,
					name = "Target",
					desc = "Target",
					order = 2,
					get = function(info) return ToT.db.profile[ info[#info] ] end,
					set = function(info, v) ToT.db.profile[ info[#info] ] = v end,
					args = {
						targetwarn = {
							type = "toggle",
							name = "Warn Target",
							desc = "Whisper your target when Tricks is cast.",
							order = 1,
						},
						warningmsg = {
							type = "input",
							name = "Warning Message",
							desc = "Warning to target of your Tricks",
							disabled = function() return not ToT.db.profile.targetwarn end,
							order = 2,
						},
						targetreport = {
							type = "toggle",
							name = "Report to target",
							desc = "Whisper your target when Tricks expires, reporting how much extra damage they did.",
							order = 3,
						},
						ignoretanks = {
							type = "toggle",
							name = "Don't whisper tanks",
							desc = "Don't whisper tanks with warnings or damage.\n|cffffff00Only works if the player is flagged as a tank in the party or Raid UI.|r",
							order = 4,
						},
					},
				},
				cooldown = {
					type = "group",
					inline = true,
					name = "Cooldown",
					desc = "Cooldown",
					get = function(info) return ToT.db.profile[ info[#info] ] end,
					set = function(info, v) ToT.db.profile[ info[#info] ] = v end,
					order = 4,
					args = {
						cdwarn = {
							type = "toggle",
							name = "Enable",
							desc = "Warn you when tricks is (almost) off cooldown.",
							order = 1,
						},
						cdprint = {
							type = "toggle",
							name = "Chat Window",
							desc = "Print a message to the default chat window.",
							disabled = function() return not ToT.db.profile.cdwarn end,
							order = 3,
						},
						cdpour = {
							type = "toggle",
							name = "Raid Warning",
							desc = "Print a message to the center of the screen. (a la X has tricksed you!)",
							disabled = function() return not ToT.db.profile.cdwarn end,
							order = 4,
						},
						cdsound = {
							type = "toggle",
							name = "Sound Warning",
							desc = "Play sound to notify when tricks is ready.",
							disabled = function() return not ToT.db.profile.cdwarn end,
							order = 5,
							width = "full",
						},
						cdsoundfile = {
							type = "select", dialogControl = 'LSM30_Sound', --dialogcontrol
							name = "Sound",
							desc = "Choose a sound to play.",
							disabled = function() return (not ToT.db.profile.cdwarn) or (not ToT.db.profile.cdsound) end,
							order = 7,
							values = AceGUIWidgetLSMlists.sound,
						},
						cdmaster = {
							type = "toggle",
							name = "Warning on Master",
							desc = "Plays the warning sound on the master channel instead of the SFX channel.",
							disabled = function() return (not ToT.db.profile.cdwarn) or (not ToT.db.profile.cdsound) end,
							order = 6,
						},
						cdwarntime = {
							type = "range",
							min = 0,
							max = 10,
							step = 1,
							name = "Warning Time",
							desc = "Warn X seconds before Tricks comes off cooldown (roughly).\n|cffffff00All warnings play at once.|r",
							disabled = function() return not ToT.db.profile.cdwarn end,
							order = 2,
						},
						soundtest = {
							type = "execute",
							order = -1,
							name = "Test Warnings",
							desc = "Play warnings at current settings.",
							func = function()
								ToT:FireWarnings()
							end,
						},
					},
				},
				threat = {
					type = "group",
					inline = true,
					name = "Threat Warnings",
					desc = "Threat Warnings",
					order = 3,
					get = function(info) return ToT.db.profile[ info[#info] ] end,
					set = function(info, v) ToT.db.profile[ info[#info] ] = v end,
					args = {
						threatwarn = {
							type = "toggle",
							name = "Enable",
							desc = "Include threat based warnings with Tricks\n|cffffff00Must have Target Warnings on for this to work.|r",
							disabled = function() return not ToT.db.profile.targetwarn end,
							order = 1,
						},
						threatpercent = {
							type = "range",
							name = "Percentage Warning",
							desc = "Warn your Tricks target if they're over this percent threat compared to your target",
							disabled = function() return (not ToT.db.profile.targetwarn) or (not ToT.db.profile.threatwarn) end,
							min = 1,
							max = 110,
							step = 1,
							order = 3,
						},
						threatraw = {
							type = "range",
							name = "Raw Threat Warning",
							desc = "Warn your Tricks target if their threat is within this raw value of the tank's compared to your target",
							disabled = function() return (not ToT.db.profile.targetwarn) or (not ToT.db.profile.threatwarn) end,
							min = 1,
							max = 200000,
							step = 1000,
							order = 4,
						},
					},
				},
				channel = {
					type = "group",
					inline = true,
					name = "Channel",
					desc = "Channel",
					order = 5,
					get = function(info) return ToT.db.profile[ info[#info] ] end,
					set = function(info, v) ToT.db.profile[ info[#info] ] = v end,
					args = {
						channelwarn = {
							type = "toggle",
							name = "Enable",
							desc = "Announce your Tricks activity to a specified channel.\n|cffff0000Use with caution!|r",
							order = 1,
						},
						channelname = {
							type = "input",
							name = "Channel Name",
							desc = "Name of channel to announce Tricks to",
							disabled = function() return not ToT.db.profile.channelwarn end,
							order = 3,
						},
						channeldamage = {
							type = "toggle",
							name = "Report Damage",
							desc = "Report the extra damage done by your tricks to the channel.",
							disabled = function() return not ToT.db.profile.channelwarn end,
							order = 4,
						},
					},
				},
			},
			order = 10,
		},
	},
}
